﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace PowerManager.Framework.DataPresentation.UpdateStrategy
{
    public sealed class OneTimeUpdate:IUpdateStrategy
    {
        public void ExecuteStrategy() {
            OnUpdateAction(null);
        }
        
        public event EventHandler UpdateAction;
        public void OnUpdateAction(EventArgs e) {
            var handle = Interlocked.CompareExchange(ref UpdateAction, null, null);
            if (handle != null) {
                handle(this, null);
            }
        }       
    }
}
